package com.xuecheng.content.convert;

import com.xuecheng.api.content.model.dto.CourseTeacherDTO;
import com.xuecheng.content.entity.CourseTeacher;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface CourseTeacherConvert {

    CourseTeacherConvert INSTANCE = Mappers.getMapper(CourseTeacherConvert.class);

    /**
     * @param courseTeacher 源对象
     * @return 转换后的对象
     * @Mapping 映射的是不能转换的属性
     */
    @Mapping(source = "id", target = "courseTeacherId")
    CourseTeacherDTO entity2dto(CourseTeacher courseTeacher);

    List<CourseTeacherDTO> entitys2dtos(List<CourseTeacher> courseTeachers);

    /**
     * @param courseTeacherDTO 源对象
     * @return 转换后的对象
     * @Mapping 映射的是不能转换的属性
     */
    @Mapping(source = "courseTeacherId", target = "id")
    CourseTeacher dto2entity(CourseTeacherDTO courseTeacherDTO);

    List<CourseTeacher> dtos2entitys(List<CourseTeacherDTO> courseTeacherDTOs);

}
